package cn;

import cn.webrx.mapper.BookMapper;
import cn.webrx.mapper.DbMapper;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo {
    public static void main(String[] args) throws SQLException {
        var ctx = new ClassPathXmlApplicationContext("beans.xml");

        var dm = ctx.getBean(DbMapper.class);
        System.out.println(dm.ver());

        var bm = ctx.getBean(BookMapper.class);
        System.out.println(bm.query());

        var ds = ctx.getBean("ds", DataSource.class);
        //System.out.println(ds.getConnection());


        var d = ctx.getBean("d", Date.class);
        var a = ctx.getBean("d", Date.class);
        //System.out.println(a == d);
        var sdf = ctx.getBean("sdf", SimpleDateFormat.class);


        //System.out.println(sdf.format(d));
        //System.out.println(sdf.format(d));


    }
}
